﻿//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>

#include "common.h"

struct Person
{
	char name[200];
	int age;
	char phone[20];
	char address[500];
};

void set_student(struct Person* st)
{
	strcpy(st->name, "Tom");
	st->age = 20;
	strcpy(st->phone, "1234567890a");
	strcpy(st->address, "Beijing China");
	/* 同以下代码：
	strcpy((*st).name, "Tom");
	(*st).age = 20;
	strcpy((*st).phone, "1234567890a");
	strcpy((*st).address, "Beijing China"); */
}

void print_student(struct Person* st)
{
	printf("Name: %s    ", (*st).name);
	printf("Age: %d    ", (*st).age);
	printf("Phone: %s    ", (*st).phone);
	printf("Address: %s\n", (*st).address);
	/* 同以下代码：
	printf("Name: %s    ", st->name);
	printf("Age: %d    ", st->age);
	printf("Phone: %s    ", st->phone);
	printf("Address: %s\n", st->address); */
}

void student_test()
{
	struct Person stu = { "name", 0, "phone", "address" };
	set_student(&stu);
	print_student(&stu);
}
